package controls.visu;

import gui.visu.components.ValuePanel;


import data.Constants;
import data.visu.DisplayDataList;
import data.visu.datasets.CurveCompareDataSet;
import data.visu.datasets.CurveDataSet;
import data.visu.enums.E_CurveTypes;


/**
 * @author Charles Perin
 * 29 mars 2011
 * LIMSI - INRIA Rennes
 * charles.perin@free.fr
 *
 */
public class CurveCompareControl extends CurveControl{


	private CurveControl curveControler1;
	private CurveControl curveControler2;

	private int mode;

	public CurveCompareControl(String name, DisplayDataList displayDataList, CurveControl curveControler1, CurveControl curveControler2, E_CurveTypes type, int mode) {
		super(name,Constants.DISPLAY_DATA_DEFAULT_COLOR,displayDataList,type);
		
		System.out.println("name="+name+", controler1="+curveControler1.getName()+", controler2="+curveControler2.getName()+", type="+type+", mode="+mode);

		this.setMode(mode);


		setCurveControler1(curveControler1);
		setCurveControler2(curveControler2);
		setxMinView(displayDataList.getxMinView());
		setxMaxView(displayDataList.getxMaxView());
		ValuePanel valuePanel = new ValuePanel(this);
		setValuePanel(valuePanel);

		if(mode!=Constants.DISPLAY_COMPARE_SUPERPOSE){
		setDataSet(new CurveCompareDataSet(((CurveDataSet) curveControler1.getDataSet()).getYMin(),
				((CurveDataSet) curveControler1.getDataSet()).getYMax(),
				curveControler1.getDataSet().getxMin(),
				curveControler1.getDataSet().getxMax(),
				curveControler1,
				curveControler2,
				mode));
		}
		else{
			setDataSet(null);
		}
	}



	public void setCurveControler1(CurveControl curveControler1) {
		this.curveControler1 = curveControler1;
	}

	public CurveControl getCurveControler1() {
		return curveControler1;
	}

	public void setCurveControler2(CurveControl curveControler2) {
		this.curveControler2 = curveControler2;
	}

	public CurveControl getCurveControler2() {
		return curveControler2;
	}

	public void setMode(int mode) {
		this.mode = mode;
	}

	public int getMode() {
		return mode;
	}

}
